package com.im.service.orgarization.smo;

import com.im.service.busiConst.dao.IBusiConstQueryDao;
import com.im.service.dto.BusiConstParam;
import com.im.service.dto.BusiConstParamVal;
import com.im.service.dto.Orgarization;
import com.im.service.orgarization.dao.IOrgarizationQueryDao;
import com.im.util.ReturnsUtil;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Service
public class OrgarizationQuerySmoImpl implements IOrgarizationQuerySmo {

    private static final Logger logger = LogManager.getLogger(OrgarizationQuerySmoImpl.class);

    @Autowired
    IOrgarizationQueryDao orgarizationQueryDao;

    @Override
    public Orgarization queryOrgarizationDetail(Orgarization orgarization) throws Exception  {
        try {
            Map<String,Object> param = new HashMap<String,Object>();
            param.put("orgarization", orgarization);
            Orgarization orgarizationDetail=orgarizationQueryDao.queryOrgarizationDetail(param);
            return orgarizationDetail;
        } catch (Exception e) {
            if (logger.isErrorEnabled()) {
                logger.error(ReturnsUtil.getStackTrackMessage(e));
            }
            throw new Exception(ReturnsUtil.getStackTrackMessage(e));
        }
    }

    @Override
    public List<Orgarization> queryAllOrg(Orgarization orgarization) {
       List<Orgarization> list= orgarizationQueryDao.queryAllOrg(orgarization);
        return list;
    }
}
